-
Notifications
You must be signed in to change notification settings - Fork 117
Fix dtype inference and session cookie handling #1237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -545,7 +545,7 @@ def build_dataframe_from_csv(raw_csv, sep='~', shaped: bool = False, | |
|
||
# make sure all element names are strings and values column is derived from data | ||
if 'dtype' not in kwargs: | ||
kwargs['dtype'] = {'Value': None, **{col: str for col in range(999)}} | ||
kwargs['dtype'] = {'Value': str, **{col: str for col in range(999)}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't want the value column to be If we set it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, that was the issue I was running into — setting 'Value': None causes pandas to infer the dtype, and in some cases like "2025" (which is an attribute value for an element and should be a string), it gets coerced to 2025.0 if other rows are missing values or inconsistent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand. But we can't enforce str as the column type for the value column. Most retrieved cube data will be numeric! In the edge cases where you load data from attribute cubes it would be easier to pass |
||
try: | ||
df = pd.read_csv(StringIO(raw_csv), sep=sep, na_values={'Value': ['None']}, keep_default_na=False, **kwargs) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is an obsolete comment or did you want to break after the first match?