Comments (5)
Thank you @philss and @cigrainger. Sorry for opening the useless issue. D:
from explorer.
Well that's a big relief @philss, thank you. I was very confused over here. Closing, as I've confirmed it:
iex(1)> IEx.configure(inspect: [charlists: :as_lists])
:ok
iex(2)> df = Explorer.Datasets.fossil_fuels()
#Explorer.DataFrame<
[rows: 1094, columns: 10]
year integer [2010, 2010, 2010, 2010, 2010, "..."]
country string ["AFGHANISTAN", "ALBANIA", "ALGERIA", "ANDORRA", "ANGOLA",
"..."]
total integer [2308, 1254, 32500, 141, 7924, "..."]
solid_fuel integer [627, 117, 332, 0, 0, "..."]
liquid_fuel integer [1601, 953, 12381, 141, 3649, "..."]
gas_fuel integer [74, 7, 14565, 0, 374, "..."]
cement integer [5, 177, 2598, 0, 204, "..."]
gas_flaring integer [0, 0, 2623, 0, 3697, "..."]
per_capita float [0.08, 0.43, 0.9, 1.68, 0.37, "..."]
bunker_fuels integer [9, 7, 663, 0, 321, "..."]
>
iex(3)> df |> Explorer.DataFrame.slice(0, 1) |> Explorer.DataFrame.to_map()
%{
bunker_fuels: [9],
cement: [5],
country: ["AFGHANISTAN"],
gas_flaring: [0],
gas_fuel: [74],
liquid_fuel: [1601],
per_capita: [0.08],
solid_fuel: [627],
total: [2308],
year: [2010]
}
from explorer.
gas_fuel
appears to also be corrupted, returning 'J'
. Looking into this with urgency.
Edit: it appears this is happening only up to a certain slice size. For example:
iex(6)> df |> Explorer.DataFrame.slice(0, 2) |> Explorer.DataFrame.to_map()
%{
bunker_fuels: '\t\a',
cement: [5, 177],
country: ["AFGHANISTAN", "ALBANIA"],
gas_flaring: [0, 0],
gas_fuel: 'J\a',
liquid_fuel: [1601, 953],
per_capita: [0.08, 0.43],
solid_fuel: [627, 117],
total: [2308, 1254],
year: [2010, 2010]
}
iex(7)> df |> Explorer.DataFrame.slice(0, 3) |> Explorer.DataFrame.to_map()
%{
bunker_fuels: [9, 7, 663],
cement: [5, 177, 2598],
country: ["AFGHANISTAN", "ALBANIA", "ALGERIA"],
gas_flaring: [0, 0, 2623],
gas_fuel: [74, 7, 14565],
liquid_fuel: [1601, 953, 12381],
per_capita: [0.08, 0.43, 0.9],
solid_fuel: [627, 117, 332],
total: [2308, 1254, 32500],
year: [2010, 2010, 2010]
}
And, just to confirm, there appears to be no problem prior to converting to a map:
iex(2)> df |> Explorer.DataFrame.slice(0, 1)
#Explorer.DataFrame<
[rows: 1, columns: 10]
year integer [2010]
country string ["AFGHANISTAN"]
total integer [2308]
solid_fuel integer [627]
liquid_fuel integer [1601]
gas_fuel integer [74]
cement integer [5]
gas_flaring integer [0]
per_capita float [0.08]
bunker_fuels integer [9]
>
iex(3)> df |> Explorer.DataFrame.slice(0, 2)
#Explorer.DataFrame<
[rows: 2, columns: 10]
year integer [2010, 2010]
country string ["AFGHANISTAN", "ALBANIA"]
total integer [2308, 1254]
solid_fuel integer [627, 117]
liquid_fuel integer [1601, 953]
gas_fuel integer [74, 7]
cement integer [5, 177]
gas_flaring integer [0, 0]
per_capita float [0.08, 0.43]
bunker_fuels integer [9, 7]
>
from explorer.
@kimjoaoun @cigrainger hey guys, I think this is just a matter of how Elixir is printing the lists. If you try this:
df = Explorer.Datasets.fossil_fuels()
df |> Explorer.DataFrame.slice(0, 1) |> Explorer.DataFrame.to_map() |> IO.inspect(charlists: :as_lists)
You can see that the inspected value is returned correctly. This is because by default IEx will try to infer the type of a list. Sometimes it is detected as charlist
. See https://hexdocs.pm/elixir/Inspect.Opts.html for details.
To disable this behavior in IEx, you can run IEx.configure(inspect: [charlists: :as_lists])
.
For more details, please check this Stackoverflow question: https://stackoverflow.com/questions/30037914/elixir-lists-interpreted-as-char-lists
from explorer.
@kimjoaoun no problem :)
from explorer.
Related Issues (20)
- Precompiled NIFs for freebsd HOT 2
- Add parse datetime from string HOT 1
- add DataFrame.frequencies/2 HOT 1
- Q: How to specify that a number is an epoch when reading a Parquet file? HOT 4
- Normalise errors to return `Exception.t()` from the backend HOT 6
- Document `:backend` and `:lazy` options for `from_*` IO functions HOT 1
- Normalize IO dataframe operations to return {:error, Exception.t}
- `mix ci` difficulties on MacOS as an Elixir beginner HOT 2
- `Explorer.Series.cut` crashes when series is a dataframe field HOT 1
- Add binding to str.slice and/or str.split and/or add trim/2 HOT 6
- `DataFrame.from_csv` incorrectly reads "NA" as `nil` HOT 2
- [Question] Linting Elixir code as an Elixir beginner HOT 1
- Pairwise operations HOT 2
- mutate only certain rows based on a filter? HOT 5
- It is not clear how to filter on categories HOT 3
- Aggregate a series to list in groupby HOT 2
- Missing behaviour on filtering DataFrames on categories. HOT 3
- &Explorer.DataFrame.print/2 does not print header names if no options is provided HOT 4
- Pass dtype to Series callbacks
- Use sink cloud versions of ipc HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from explorer.